package Strategy;

/**
 * 地理坐标点
 */
public class Coordinate {
    private double x;  // 纬度
    private double y; // 经度

    public Coordinate(double x, double y) {
        this.x = x;
        this.y = y;
    }

    public double distanceTo(Coordinate other) {
        double dx = this.x - other.x;
        double dy = this.y - other.y;
        return Math.sqrt(dx * dx + dy * dy); // 平面欧氏距离（米）
    }

    // Getters


    public double getX() {
        return x;
    }

    public double getY() {
        return y;
    }


    public void setX(double x) {
        this.x = x;
    }

    public void setY(double y) {
        this.y = y;
    }

    @Override
    public String toString() {
        return String.format("(%.6f, %.6f)", x, y);
    }
}
